<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
<button>按钮</button>
</body>
<script>
document.querySelector('button').onclick = function() {
    // 发送post请求
    var xhr = new XMLHttpRequest
    xhr.open('delete', 'http://localhost:3000/user/4')
    
    xhr.send()
    
    xhr.onreadystatechange = function() {
        if(xhr.readyState === 4) {
            if(xhr.status >= 200 && xhr.status < 300) {
                var msg = xhr.responseText
                console.log(msg);
            }
        }
    }
}
</script>
</html>